package com.remist.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

@Entity
@Table(name = "product")
@PrimaryKeyJoinColumn(name = "Id")
public class Product {
	private int id;
	private String itemCode;
	private double price;
	private String material;
	private double weight;
	private String bandWidth;
	private String size;
	private String color;
	private String dimension;
	private String description;
	private int typeId;
	private String	imageUrl;
	private String	necklaceLength;
	private double 	goldPrice;
	private double 	silverPrice;
	private double 	copperPrice;
	private double 	currentPrice;
	private ProductType productType;
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "Id")
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getItemCode() {
		return itemCode;
	}
	public double getPrice() {
		return price;
	}
	public String getMaterial() {
		return material;
	}
	public double getWeight() {
		return weight;
	}
	public String getBandWidth() {
		return bandWidth;
	}
	public String getSize() {
		return size;
	}
	public String getColor() {
		return color;
	}
	public String getDimension() {
		return dimension;
	}
	public String getDescription() {
		return description;
	}

	public String getImageUrl() {
		return imageUrl;
	}
	public String getNecklaceLength() {
		return necklaceLength;
	}
	public double getGoldPrice() {
		return goldPrice;
	}
	public double getSilverPrice() {
		return silverPrice;
	}
	public double getCopperPrice() {
		return copperPrice;
	}
	public double getCurrentPrice() {
		return currentPrice;
	}
	public void setItemCode(String itemCode) {
		this.itemCode = itemCode;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	public void setMaterial(String material) {
		this.material = material;
	}
	public void setWeight(double weight) {
		this.weight = weight;
	}
	public void setBandWidth(String bandWidth) {
		this.bandWidth = bandWidth;
	}
	public void setSize(String size) {
		this.size = size;
	}
	public void setColor(String color) {
		this.color = color;
	}
	public void setDimension(String dimension) {
		this.dimension = dimension;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public void setTypeId(int typeId) {
		this.typeId = typeId;
	}
	public int getTypeId() {
		return typeId;
	}
	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}
	public void setNecklaceLength(String necklaceLength) {
		this.necklaceLength = necklaceLength;
	}
	public void setGoldPrice(double goldPrice) {
		this.goldPrice = goldPrice;
	}
	public void setSilverPrice(double silverPrice) {
		this.silverPrice = silverPrice;
	}
	public void setCopperPrice(double copperPrice) {
		this.copperPrice = copperPrice;
	}
	public void setCurrentPrice(double currentPrice) {
		this.currentPrice = currentPrice;
	}

	//@OneToOne(optional = false, cascade = CascadeType.REFRESH) ,referencedColumnName = "id",unique=false
	
//	@JoinColumn(name = "typeId",nullable=false,unique=false,referencedColumnName="id")
//	@OneToOne(optional=false)
	
	@ManyToOne(optional = false, cascade = CascadeType.REFRESH)
	@JoinColumn(name="typeId",referencedColumnName="id",insertable=false,updatable=false)
//	@JoinTable(name = "producttype", joinColumns=@JoinColumn(name = "id"), inverseJoinColumns = @JoinColumn(name = "typeId"))
	public ProductType getProductType() {
		return productType;
	}
	public void setProductType(ProductType productType) {
		this.productType = productType;
	}
 
}
